package com.newsproject.service;

import java.util.ArrayList;
import java.util.Map;

import javax.servlet.http.HttpSession;

import org.springframework.stereotype.Service;
import org.springframework.web.servlet.ModelAndView;

import com.newsproject.pojo.HotSearch;
import com.newsproject.pojo.Post;
import com.newsproject.pojo.User;

@Service
public interface SearchService {
    // 搜索用户
    public ArrayList<User> searchUsers(String username);
    // 搜索新闻
    public ArrayList<Post> searchNews(String title, int category);
    // 获取热搜榜单
    public ArrayList<HotSearch> getHotSearches(int limit);
    // 检查分类ID或标签ID是否存在
    public boolean checkCategoryIdOrTagId(int categoryId, int tagId);
    // 根据新闻ID查询对应的新闻
    public Post getPostById(int postId);
    // 获取今日热搜榜单
    public ArrayList<HotSearch> getTodayHotSearches(int limit, String today);

    /*
     * 为API提供的接口
     */
    // 搜索用户和新闻Map<用户或新闻, 相关信息的集合>
    public Map<String, Object> search(String query,HttpSession session);

    public ModelAndView searchPage(String searchString,HttpSession session);

    public ModelAndView hotSearch(int Num);

    public Map<String, Object> HotSearch(int Num);

    public ModelAndView todayHotSearch(int Num);

    public Map<String, Object> searchApi(int Num);
}
